<template>
<div>
  <!--头部区域-->
  <div style="height: 60px;line-height:60px;background-color: white;margin-bottom: 2px;display:flex">
   <div style="width:300px ">
     <img src="@/assets/logo.png" alt="" style="width: 45px;position: relative;top: 15px;left: 20px ">
     <span style="margin-left: 25px;font-size:24px ">题库系统</span>
   </div>
    <div style="flex: 1;text-align:right;padding-right: 20px">
      <el-dropdown size="medium">
  <span class="el-dropdown-link" style="cursor:pointer">
  管理员<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
        <el-dropdown-menu slot="dropdown" style="margin-top: -10px">
          <el-dropdown-item><div style="width: 50px;text-align: center" @click="logout">退出</div></el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
    </div>
  </div>

  <!--侧边栏和主体-->
  <div style="display:flex">
    <!--侧边栏导航-->
    <div style="width: 200px;min-height:calc(100vh - 62px);overflow: hidden;margin-left:2px ;background-color: white;">
      <el-menu :default-active="$route.path"   router class="el-menu-demo">
        <el-menu-item index="/">
          <i class="el-icon-eleme"></i>
          <span>首页</span>
        </el-menu-item>
        <el-submenu index="question">
          <template slot="title">
            <i class="el-icon-star-off"></i>
            <span>试题管理</span>
          </template>
          <el-menu-item index="/questionList">试题列表</el-menu-item>
          <el-menu-item index="/addQuestion">试题添加</el-menu-item>

        </el-submenu>



        <el-submenu index="category">
          <template slot="title">
            <i class="el-icon-user"></i>
            <span>学院及课程管理</span>
          </template>
          <el-menu-item index="/categoryList">学院及课程列表</el-menu-item>
          <el-menu-item index="/addCategory">学院添加</el-menu-item>

        </el-submenu>
        <el-submenu index="paper">
          <template slot="title">
            <i class="el-icon-notepaper-1"></i>
            <span>试卷管理</span>
          </template>
          <el-menu-item index="/paperList">试卷列表</el-menu-item>
          <el-menu-item index="/addPaper">试卷添加</el-menu-item>

        </el-submenu>
        <el-submenu index="admin">
          <template slot="title">
            <i class="el-icon-user"></i>
            <span>管理员管理</span>
          </template>
          <el-menu-item index="/adminList">管理员列表</el-menu-item>
          <el-menu-item index="/addAdmin">管理员添加</el-menu-item>

        </el-submenu>

      </el-menu>
    </div>
    <!--主体数据-->
    <div style="flex:1;background-color:white;padding:10px">
      <router-view/>
    </div>
  </div>
</div>
</template>

<script>
export default {
  name: "Layout.vue",
  methods:{
    logout(){
      this.$router.push('login')
      //清楚浏览器用户数据
    }
  }
}
</script>

<style scoped>

</style>